package com.chenxin.dubbo.controller;

import com.chenxin.dubbo.entity.Bean;
import com.chenxin.dubbo.service.BeanService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BeanController {

    @Reference
    private BeanService beanService;

    @RequestMapping("/getBean")
    public void getBean(){

        List<Bean> bean = beanService.getBean();
        bean.forEach(bean1 -> {
            System.out.println(bean1.toString());
        });

        /**
         * 解析bean
         */
        Bean beanEntity= new Bean();
        beanEntity.setId(1);
        beanEntity.setUsername("zhangsan");
        beanEntity.setTargetId("1213131");
        beanEntity.setPassword("9jjfj");
        beanService.resolveBean(beanEntity);
    }
}
